package com.mk.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mk.common.DeleteRequest;
import com.mk.model.dto.space.SpaceAddRequest;
import com.mk.model.dto.space.SpaceEditRequest;
import com.mk.model.dto.space.SpaceQueryRequest;
import com.mk.model.dto.space.SpaceUpdateRequest;
import com.mk.model.entity.Space;
import com.mk.model.entity.User;
import com.mk.model.vo.space.SpaceVO;

/**
 * @author zkm
 * @description 针对表【space(空间)】的数据库操作Service
 * @createDate 2024-12-28 17:01:24
 */
public interface SpaceService extends IService<Space> {

    /**
     * 删除空间
     *
     * @param deleteRequest
     * @param loginUser
     * @return
     */
    Boolean deleteSpace(DeleteRequest deleteRequest, User loginUser);

    /**
     * 新增空间
     *
     * @param spaceAddRequest
     * @param loginUser
     * @return 创建空间的ID
     */
    Long addSpace(SpaceAddRequest spaceAddRequest, User loginUser);

    /**
     * 空间更新
     *
     * @param updateRequest
     * @return
     */
    Long updateSpace(SpaceUpdateRequest updateRequest, User loginUser);

    /**
     * 空间编辑
     *
     * @param editRequest
     * @return
     */
    Boolean editSpace(SpaceEditRequest editRequest, User loginUser);

    /**
     * 获取单个空间封装
     *
     * @param id
     * @return
     */
    SpaceVO getSpaceVOById(Long id);

    /**
     * 分页获取空间封装
     *
     * @param queryRequest
     * @return
     */
    Page<SpaceVO> pageSpaceVO(SpaceQueryRequest queryRequest);

    /**
     * 获取单个空间VO
     *
     * @param space
     * @return
     */
    SpaceVO getSpaceVO(Space space);

    /**
     * 分页获取空间封装
     *
     * @return
     */
    Page<SpaceVO> getSpaceVOPage(Page<Space> spacePage);

    /**
     * 获取查询wrapper
     *
     * @param queryRequest
     * @return
     */
    QueryWrapper<Space> getQueryWrapper(SpaceQueryRequest queryRequest);

    /**
     * 填充默认参数
     *
     * @param space
     */
    void fillSpaceByLevel(Space space);

    void checkIdAuthWithExists(Long id, User loginUser);

    void validSpace(Space space, boolean add);
}
